package com.CoreryBlack.interceptors;//package com.coreryblack.interceptors;
//
//import jakarta.servlet.http.HttpServletRequest;
//import jakarta.servlet.http.HttpServletResponse;
//import org.springframework.stereotype.Component;
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.ModelAndView;
//
///**
// * @Description DemoInterceptor
// * @Author CoreryBlack
// * @Date 2024-09-22
// */
//
//@Component
//public class DemoInterceptor implements HandlerInterceptor {
//    //请求前拦截。返回true：放行   返回false：不放行
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        System.out.println("DemoInterceptor请求前拦截");
//
//        return true;//放行
//    }
//
//    //请求后拦截   前提：控制器方法运行不能发生异常
//    @Override
//    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws  Exception {
//        System.out.println("DemoInterceptor请求后拦截");
//    }
//
//    //最终拦截，控制器方法运行后执行  不论控制器方法运行是否发生异常都会执行
//    @Override
//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)throws Exception {
//        System.out.println("DemoInterceptor最终拦截");
//    }
//}
